package cn.itsource.ymcc.producer;

import cn.itsource.ymcc.common.constant.RocketConstants;
import cn.itsource.ymcc.common.result.JsonResult;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class CourseMessageProduceImpl implements CourseMessageProduce{
    @Autowired
    private RocketMQTemplate rocketMQTemplate;

    @Override
    public JsonResult sendSMS(String message) {
        rocketMQTemplate.sendOneWay(RocketConstants.COURSE_SEND_SMS_TOPIC+":"
                +RocketConstants.COURSE_SEND_SMS_TAG,message);
        return JsonResult.success();
    }

    @Override
    public JsonResult sendEmail(String message) {
        rocketMQTemplate.sendOneWay(RocketConstants.COURSE_SEND_EMAIL_TOPIC+":"
                +RocketConstants.COURSE_SEND_EMAIL_TAG,message);
        return JsonResult.success();
    }

    @Override
    public JsonResult sendSystem(String message) {
        rocketMQTemplate.sendOneWay(RocketConstants.COURSE_SEND_SYSTEM_TOPIC+":"
                +RocketConstants.COURSE_SEND_SYSTEM_TAG,message);
        return JsonResult.success();
    }
}
